<template>
  <div id="app" class>
    <transition :appear="true" :name="SkipSwitchName">
      <keep-alive include="Home">
        <router-view class="position-div" />
      </keep-alive>
    </transition>
  </div>
</template>

<style lang='scss'>
.te {
  .blackOrWhite {
    background: #111 !important;
    border: 0 !important;
    color: #ccc;
  }
  .blackOrWhite * {
    background: #111 !important;
    border: 0 !important;
    color: #ccc;
  }
}
* {
  margin: 0;
  padding: 0;
  font-size: 0.16rem;
  li {
    list-style: none;
  }
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}
#app,
html,
body,
#content {
  width: 100%;
  height: 100%;
}

.slide-right-enter-active,
.slide-right-leave-active,
.slide-left-enter-active,
.slide-left-leave-active {
  will-change: transform;
  transition: all 300ms;
  position: absolute;
}

.slide-right-enter {
  opacity: 0;
  transform: translateX(-100%);
}

.slide-right-leave-active {
  opacity: 0;
  transform: translateX(100%);
}

.slide-left-enter {
  opacity: 0;
  transform: translateX(100%);
}

.slide-left-leave-active {
  opacity: 0;
  transform: translateX(-100%);
}
.position-div {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}
</style>

<script>
export default {
  data: function() {
    return {
      SkipSwitchName: "slide-left"
    };
  },
  watch: {
    $route(to, from) {
      if (to.meta.tx > from.meta.tx) {
        this.SkipSwitchName = "slide-left";
      } else {
        this.SkipSwitchName = "slide-right";
      }
    }
  }
};
</script>